/*
 * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

static uint32_t GetEnvironmentChecksum(Arch arch) {
    // Checksums are based on entrypoints signatures + cross-values(arch)
    switch(arch) {
% cross_values_path = ARGV[0]
% if (Dir.glob(cross_values_path + "/generated_values/*_values_gen.h").size == 0)
%   raise "Invalid cross-values path (" + cross_values_path + "/generated_values/*_values_gen.h" + ")"
% end
% Dir.glob(cross_values_path + "/generated_values/*_values_gen.h").each do |cross_values_h|
        case Arch::<%= File.basename(cross_values_h, "_values_gen.h") %>:
            return <%= Compiler::environment_checksum(cross_values_h) %>;  // NOLINT(readability-magic-numbers)
% end
        default:
            LOG(FATAL, COMPILER) << "Arch `" << GetArchString(arch) << "` is not supported";
            UNREACHABLE();
    }
}
